<?php
  if(isset($_GET["id"]) == false)
    DataProvider::ExecuteQuery('index.php?chitietloai=3');

  $id = $_GET['id'];
  $sql = "SELECT * FROM chitietloaisach WHERE MaChiTietLoaiSach = $id";
  $result = DataProvider::ExecuteQuery($sql);
  $row = mysql_fetch_array($result);
?>


<div class="span11">
    <form name="RegisterForm" method="post" action="pages/pExSuaChiTietLoai.php?act=do&id=<?php echo $row["MaChiTietLoaiSach"] ?>" id="RegisterForm" class="form-horizontal" enctype="multipart/form-data">
    <div class="head">
        <div class="isw-documents"></div>
        <h1>Cập Nhật Chi Tiết Loại Sách "<?php echo $row['TenChiTietLoaiSach']; ?>"</h1>
        <div class="clear"></div>
    </div>
    <div class="block-fluid">
        <div class="row-form">
            <div class="span3">Loại Sách: (Cũ là:
                <?php
                    $ma = $row["MaLoaiSach"];

                    $sql2 = "SELECT * FROM loaisach WHERE MaLoaiSach='$ma'";
                    $result2 = DataProvider::ExecuteQuery($sql2);
                    $row2 = mysql_fetch_array($result2);

                    echo $row2["TenLoaiSach"];

                ?>
                )

            </div>
            <div class="span2">
                <select name="oploaisach" id="oploaisach">
                        <option value="">Loại Sách...</option>
                        <?php

                            $sql3 = "SELECT * FROM loaisach WHERE Bixoa=0";
                            $result3 = DataProvider::ExecuteQuery($sql3);

                            while($row3 = mysql_fetch_array($result3))
                                {
                        ?>
                        <option value="<?php echo $row3['MaLoaiSach']; ?>"><?php echo $row3['TenLoaiSach']; ?></option>


                        <?php
                            }
                        ?>


                </select>
            </div>
            <div class="clear"></div>
        </div>

        <div class="row-form">
            <div class="span3">Tên Chi Tiết Loại Sách (Cũ là: <?php echo $row['TenChiTietLoaiSach']; ?>): </div>
            <div class="span9"><input name="txtChiTietloaisach" type="text" id="txtChiTietloaisach" placeholder="Tên Chi Tiết Loại Sách"></div>
            <div class="clear"></div>
        </div>


        <div class="row-form">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="submit" name="btnSubmit" value="Cập nhật" id="btnSubmit" class="btn btn-primary" >

            <input class="btn btn-danger" onclick="location = 'index.php?b=7';" type="button" value="Quay Lại">

        </div>

    </div>
    </form>
</div>